package com.zhou.cloud.service.impl;

import com.github.pagehelper.PageHelper;
import com.zhou.cloud.dao.entity.Order;
import com.zhou.cloud.dao.mapper.OrderMapper;
import com.zhou.cloud.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @descrition:
 * @author: zhouyongjun
 * @date: 2022/10/27
 **/
@Service
public class OrderServiceImpl  implements IOrderService {
    @Autowired
    OrderMapper orderMapper;
    @Override
    public Order get(Long id) {
        return orderMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Order> getAll() {
        return orderMapper.selectAll();
    }

    @Override
    public boolean add(Order order) {
        orderMapper.insert(order);
        return true;
    }

    @Override
    public List<Order> getListByPage(int page, int pageNum) {
        PageHelper.startPage(page,pageNum);
        return getAll();
    }
}
